//
//  exception_impl.hpp
//  utilities
//
//  Created by Sam Jaffe on 2/4/15.
//  Copyright (c) 2015 Sam Jaffe. All rights reserved.
//

#pragma once

namespace options {
    missing_options::missing_options(const std::set<parameter_base*>& missing) :
    missing(missing) {
    }
    
    const char* missing_options::what() const noexcept(true) {
        std::stringstream ss;
        ss << "The following arguments are missing: ";
        for (auto param : missing) {
            ss << *(param->get_names().begin());
        }
        return ss.str().c_str();
    }
    
    not_enough_arguments::not_enough_arguments(int min, int given) :
    min_args(min), given(given) {
    }
    
    const char* not_enough_arguments::what() const noexcept(true) {
        return min_args == -1 ? "not enough arguments for option" : ("not enough arguments for option, expected: >=" + std::to_string(min_args) + ", got: " + std::to_string(given)).c_str();
    }
    
    const char* invalid_arity::what() const noexcept(true) {
        return "arity cannot be negative";
    }
    
    illegal_option_signature::illegal_option_signature() {
    }
    illegal_option_signature::illegal_option_signature(const char* cause) :
    cause(cause) {
    }
    const char* illegal_option_signature::what() const noexcept(true) {
        return (std::string("illegal option -- ") + cause).c_str();
    }
}